package com.windoent.yugioh.adapter.brvah;

import android.annotation.SuppressLint;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.google.android.flexbox.AlignSelf;
import com.google.android.flexbox.FlexboxLayoutManager;
import com.windoent.yugioh.R;
import com.windoent.yugioh.utils.LogUtils;

/**
 * author : robert
 * date   : 2021/5/6 15:26
 * desc   :
 */
public class ZiXunSearchAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    public ZiXunSearchAdapter() {
        super(R.layout.item_list_zixun_search, null);
    }

    @SuppressLint("WrongConstant")
    @Override
    protected void convert(@NonNull BaseViewHolder helper, String item) {
        helper.setText(R.id.tv_content, item);
        TextView textView = helper.getView(R.id.tv_content);
        ViewGroup.LayoutParams layoutParams = textView.getLayoutParams();
        if (layoutParams instanceof FlexboxLayoutManager.LayoutParams) {
            FlexboxLayoutManager.LayoutParams flexboxLp = (FlexboxLayoutManager.LayoutParams) layoutParams;
            flexboxLp.setFlexGrow(0f);//1平分
            flexboxLp.setAlignSelf(AlignSelf.FLEX_START);
        }
    }
}